GRU-based Time-Series Forecasting Model to Predict Household Electric Power Consumption

GRU-based Time-Series Forecasting Model to Predict Household Electric Power Consumption

Problem Statement

Develop a GRU-based time-series forecasting model to predict household electric power consumption using historical electricity usage data and evaluate its performance using MAE and RMSE.

Download Dataset: Household_Power_Consumption.txt


Dataset Description

The dataset contains measurements of electric power consumption in one household, recorded over time.

AttributeDescription
DateDate of measurement
TimeTime of measurement
Global_active_powerHousehold global active power in kilowatts (kW)
Global_reactive_powerHousehold global reactive power in kilowatts
VoltageAverage voltage in volts
Global_intensityAverage current intensity in amperes
Sub_metering_1Energy consumption mainly from kitchen appliances
Sub_metering_2Energy consumption mainly from laundry appliances
Sub_metering_3Energy consumption mainly from water heater and air conditioner

For our GRU practical, the main prediction variable will be:

Global_active_power 


Go to Jupyter Notebook


Dataset contain 278,730 rows × 9 columns.

But for our model, we selected only 1 column: Global_active_power, 

time_step = 60  

Total sequences

The formula is:

Total Sequences=Total Rows−time_step\text{Total Sequences} = \text{Total Rows} - \text{time\_step}

Therefore:

278,730−60=278,670278,730 - 60 = \mathbf{278,670}

So the model creates 278,670 sequences. 

What is inside each sequence?

Each sequence contains 60 consecutive Global_active_power readings as input and 1 next reading as the target.  


Sequence 1:  Rows 0–59       → Target Row 60

Sequence 2:  Rows 1–60       → Target Row 61

Sequence 3:  Rows 2–61       → Target Row 62

...

Sequence 60: Rows 59–118     → Target Row 119

...

Last Sequence: Rows 278669–278728 → Target Row 278729


So here 

X Shape: (278670, 60) 

y Shape: (278670,)

And after reshaping for GRU: 

X Shape: (278670, 60, 1)

278,670 sequences × 60 time steps per sequence × 1 feature. 


टिप्पणी पोस्ट करा

0 टिप्पण्या